const { defineConfig } = require("@vue/cli-service");

module.exports = defineConfig({
    transpileDependencies: true,
    pluginOptions: {
        electronBuilder: {
            nodeIntegration: true,
            builderOptions: {
                // 产品名称
                productName: `${process.env.VUE_APP_TITLE}`,
                compression: "normal",
                artifactName: "${productName}-${version}-${os}-${arch}.${ext}",
                "publish": [
                    {
                        "provider": "generic",
                        "url": process.env.VUE_APP_UPDATE_URL
                    }
                ],
                mac: {
                    extendInfo: {
                        NSCameraUsageDescription: "This app requires camera access to record video.",
                        NSMicrophoneUsageDescription: "This app requires microphone access to record audio."
                    },
                    hardenedRuntime: true,
                    gatekeeperAssess: false,
                    entitlements: "build/mac/entitlements.mac.plist",
                    entitlementsInherit: "build/mac/entitlements.mac.plist",
                    target: [
                        {
                            target: "default",
                            arch: [
                                "universal"
                            ]
      
                        }
                    ]
                },
                linux: {
                    category: "Admin",
                    executableName: "trade-pc-admin",
                    target: [
                        "deb",
                        "AppImage"
                    ]
                },
                deb: {
                    afterInstall: "entries/install.sh"
                },
                extraResources: [
                    {
                        from: "./build/icons",
                        to: "extraResources/icons"
                    }
                ],
                extraFiles: [
                    {
                        from: "entries",
                        to: "entries"
                    }
                ],
                win: {
                    icon: `build/icons/${process.env.VUE_APP_ICON}`,
                    target: "nsis",
                    requestedExecutionLevel: "requireAdministrator"
                },
                nsis: {
                    oneClick: false,
                    allowToChangeInstallationDirectory: true,
                    artifactName: "${productName}-${version}-${os}-${arch}-setup.${ext}",
                    deleteAppDataOnUninstall: true,
                    perMachine: false,
                    createDesktopShortcut: true,
                    shortcutName: "${productName}",
                }
            }
        }
    },
});